GitHub for…ecology?

Why are we using GitHub for an ecology course?

Version control

Going from:

A data directory with many similar filenames like "Final_FINAL.R"

Version control

To:

A data directory with many similar filenames like "Final_FINAL.R"

A data directory with many similar filenames like "Final_FINAL.R"

Reproducibility

A data directory with many similar filenames like "Final_FINAL.R"

Citability

A data directory with many similar filenames like "Final_FINAL.R"

Collaboration

A data directory with many similar filenames like "Final_FINAL.R"

A data directory with many similar filenames like "Final_FINAL.R"

Other fun stuff

A data directory with many similar filenames like "Final_FINAL.R"

Other fun stuff

A data directory with many similar filenames like "Final_FINAL.R"

Other fun stuff

A data directory with many similar filenames like "Final_FINAL.R"

A data directory with many similar filenames like "Final_FINAL.R"

A Git(Hub) glossary

Repositories

Repositories on GitHub correspond to tracked working directories on your computer.

A data directory with many similar filenames like "Final_FINAL.R"

A data directory with many similar filenames like "Final_FINAL.R"

Cloning

Cloning downloads a repository from the cloud (GitHub) to your local computer, and links your local copy to the cloud.

A data directory with many similar filenames like "Final_FINAL.R"

A data directory with many similar filenames like "Final_FINAL.R"

Commits

When you make changes to a repository, committing your changes saves a snapshot in the version history.

A data directory with many similar filenames like "Final_FINAL.R"

Commits

Commit messages record notes on what changes with each update.

A data directory with many similar filenames like "Final_FINAL.R"

Push and pull

Pushing and pulling synchronize changes made on your local computer with changes in the cloud, and vice versa.

The push and pull buttons in RStudio

Branching

Branches allow you to make changes to a repository without modifying the primary source code.

A page with branches in GitHub

Forks

Forks are similar to branches, but copy a whole repository to your personal GitHub account.

A forked repository in GitHub

Pull request

When you finish making changes in a branch or fork, opening a pull request allows collaborators to review your changes and add them to the primary version.

A pull request in GitHub

Putting it all together

[Cut to AJR + RMD working through an example on Zoom?]

Your turn!

Before class, please install:

  • Git (instructions available here: https://github.com/git-guides/install-git)
  • R (available here: https://www.r-project.org/)
  • RStudio (available here: https://www.rstudio.com/products/rstudio/download/#download)

Any problems, please open an issue: https://github.com/eco-evo-thr-2022/12-github-rmarkdown/issues/new

Your turn!

We’ll link GitHub with RStudio in class, following this tutorial:

Git and RStudio instructions: https://www.ecoevomatics.org/2021/09/14/rstudio_github.html

Resources

Happy Git with R: https://happygitwithr.com/

Ten simple rules for taking advantage of GitHub: https://doi.org/10.1371/journal.pcbi.1004947